<?php
use Illuminate\Support\Str;
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>列表页</title>
  @include('common/static')
</head>
<body>
  @include('common/header')
  <div class="main">
    <div class="main-crumb">
      <div class="container">
        <!-- 面包屑导航 -->
        <nav aria-label="breadcrumbs">
          {!! Breadcrumbs::render('category', $id) !!}
        </nav>
      </div>
    </div>
    <div class="container">
      <div class="row">
        <div class="col-md-9">
          <!-- 内容列表 -->
          <div class="row">
            @foreach ($content as $con)
            <div class="col-md-6 mb-4">
              <div class="card main-card">
                <div class="main-card-pic">
                  <a href="{{ url('detail', ['id' => $con->id]) }}">
                    <img @if ($con->image) src="/static/upload/{{ $con->image }}" @else src="{{asset('admin')}}/img/noimg.png" @endif alt="">
                    <span><i class="fa fa-search"></i></span>
                  </a>
                </div>
                <div class="card-body">
                  <div class="main-card-info">
                    <span>
                      <i class="fa fa-calendar"></i>
                      {{ date('Y-m-d', strtotime($con->created_at)) }}
                    </span>
                    <span>
                      <i class="fa fa-comments"></i>0
                    </span>
                  </div>
                  <h3><a href="{{ url('detail', ['id' => $con->id]) }}">{{ $con->title }}</a></h3>
                  <div class="main-card-desc">
                    {!! Str::limit($con->content, 100) !!}
                  </div>
                </div>
                <a href="{{ url('detail', ['id' => $con->id]) }}" class="main-card-btn">阅读更多</a>
              </div>
            </div>
            @endforeach
          </div>
          {{ $content->links() }}
        </div>
        <div class="col-md-3">
          <!-- 侧边栏 -->
          @include('common/sidebar')
        </div>
      </div>
    </div>
  </div>
  @include('common/footer')
</body>
</html>